﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>驰骋工作流</title>
    <script src="../../../Scripts/CodeMirror/lib/codemirror.js"></script>
    <link href="../../../Scripts/CodeMirror/lib/codemirror.css" rel="stylesheet" />
    <script src="../../../Scripts/CodeMirror/addon/comment/comment.js"></script>
    <script src="../../../Scripts/CodeMirror/mode/javascript/javascript.js"></script>
    <script src="../../../Scripts/CodeMirror/addon/comment/continuecomment.js"></script>
    <script src="../../../Scripts/CodeMirror/addon/edit/matchbrackets.js"></script>
    <!-- 引用通用的js文件. -->
    <link href="../../../Comm/Style/Table0.css" rel="stylesheet" type="text/css" />
    <link href="../../../Scripts/easyUI/themes/icon.css" rel="stylesheet" type="text/css" />
    <link href="../../../Scripts/easyUI/themes/default/easyui.css" rel="stylesheet" type="text/css" />
    <script src="../../../Scripts/easyUI/jquery-1.8.0.min.js" type="text/javascript"></script>
    <script src="../../../Scripts/easyUI/jquery.easyui.min.js" type="text/javascript"></script>
    <script src="../../../Scripts/EasyUIUtility.js" type="text/javascript"></script>
    <script src="../../../Scripts/QueryString.js" type="text/javascript"></script>
    <script type="text/javascript" src="../../../Scripts/config.js"></script>
    <script type="text/javascript" src="../../../Comm/Gener.js"></script>
    <script type="text/javascript" language="javascript">
        //初始化页面函数.....
        var editor = "";
        //杨玉慧
        $(function () {
            editor = CodeMirror.fromTextArea(document.getElementById("code"), {
                lineNumbers: true,
                matchBrackets: true,
                continueComments: "Enter",
                extraKeys: { "Ctrl-Q": "toggleComment" }
            });
            Init();

        });

        function Init() {

            var frmID = GetQueryString("FK_MapData");
            //创建处理类.
            var handler = new HttpHandler("BP.WF.HttpHandler.WF_Admin_FoolFormDesigner_MapExt");
            handler.AddUrlData();
            var data = handler.DoMethodReturnString("InitScript_Init"); //执行方法，返回执行结果.


            if (data.indexOf("err@") == 0) {
                alert(data)
            }
            else {
                $('#code').val(data);
                editor.setValue($("#code").val());
            }
            return;
        }

        function Save() {
            var frmID = GetQueryString("FK_MapData");
            //创建处理类.
            var handler = new HttpHandler("BP.WF.HttpHandler.WF_Admin_FoolFormDesigner_MapExt");
            var jsDocVal = editor.getValue();
            handler.AddUrlData();
            handler.AddPara("JSDoc", jsDocVal);
            var data = handler.DoMethodReturnString("InitScript_Save"); //执行方法，返回执行结果.

            alert(data);
            return;
        }

        function Delete() {

            if (window.confirm('您确定要删除/清空吗？') == false)
                return;

            var frmID = GetQueryString("FK_MapData");
            //创建处理类.
            var handler = new HttpHandler("BP.WF.HttpHandler.WF_Admin_FoolFormDesigner_MapExt");
            handler.AddUrlData();
            var data = handler.DoMethodReturnString("InitScript_Delete"); //执行方法，返回执行结果.

            window.location.href = window.location.href;
            return;
        }
    </script>
</head>
<body onload="Load()">

    <form id="cc">
        <table id="table" style="width: 100%;">
            <tr>
                <td colspan="1">
                    <h3>JS脚本，该数据将要保存到\DataUser\JSLab\*.js下。</h3>
                </td>
                <td colspan="2">
                    <input type="button" value="保存" onclick="Save()" id="Btn_Save" />
                    <input type="button" value="删除" onclick="Delete()" id="Btn_Delete" />
                </td>
            </tr>

            <tr>
                <td colspan="3" style="width: 100%;">
                    <textarea rows="20" name="code" id="code" style="width:100%;"> </textarea>
                </td>
            </tr>
            <tr>
                <td colspan="3">
                    <fieldset id="help">
                        <legend>帮助</legend>
                        <ul>
                            <li> xxx </li>
                        </ul>
                    </fieldset>

                </td>
            </tr>
        </table>
       
    </form>

</body>
</html>
